//算法思想
//首先将数组A[m + n]中的全部元素原地逆置，
//再对前n个元素和后m个元素分别使用逆置算法，
//从而实现顺序表的位置互换
typedef int ElemType;

void Reserve(ElemType A[], int left, int right, int arraySize) {
    if (left >= right || right >= arraySize) {
        return;
    }
    int mid = (left + right) / 2;
    int i;
    for (i = 0; i <= mid - left; i++) {
        ElemType t = A[left + i];
        A[left + i] = A[right - i];
        A[right - i] = A[left + i];
    }
}

void Exchange(ElemType A[], int m, int n, int arraySize) {
    Reserve(A, 0, m + n - 1, arraySize);
    Reserve(A, 0, n - 1, arraySize);
    Reserve(A, n, m + n - 1, arraySize);
}